package validator

import "payment/model"

type PayEntryValidator struct {
	AppId      model.AppId      `form:"app_id"`
	AppOrderId string           `form:"app_order_id"`
	PayChannel model.PayChannel `form:"pay_channel"`
	Amount     int64            `form:"amount"`
	UserId     string           `form:"uid"`
	UserName   string           `form:"user_name"`
	Phone      string           `form:"phone"`
	Email      string           `form:"email"`
}

func (rs *PayEntryValidator) Valid() (res bool, msg string) {
	if rs.AppId == "" {
		return false, "app_id is empty"
	}
	if rs.PayChannel == "" {
		return false, "pay_channel is empty"
	}
	if rs.AppOrderId == "" {
		return false, "app_order_id is empty"
	}
	if rs.Amount == 0 {
		return false, "amount is empty"
	}
	return true, ""
}
